﻿#ifndef LOGPROCESS_H
#define LOGPROCESS_H

#include <QObject>
#include <QFile>
#include <QMessageBox>
#include <general.h>




class LogProcess : public QObject
{
    Q_OBJECT
public:
    explicit LogProcess(QObject *parent = nullptr);
    ~LogProcess();
    void readFile(const QString &file);
    unsigned int getTotalCycleNumber();
    QByteArray getCycleData(const int &cycleNumber);                            // 根据周期步进值以及标志位获取数据
    void setFormatSetting(struct _format_settings* pFormatSetting);
    QDateTime getStartDateTime();
    QDateTime getEndDateTime();
    void closeFile();


signals:

public slots:
    void logCaptureSlot(QDateTime start, QDateTime end, QString filePath);


private:
    QFile* pLogFile = NULL;                                                                         // 日志文件指针
    QDataStream* pLogFileStream = NULL;                                                             // 日志文件数据流
    int* pCurrentCycle = NULL;                                                                      // 日志读取当前周期(起始周期为1)
    struct _format_settings* pFormatSetting = NULL;
    QDateTime mStartDateTime;
    QDateTime mEndDateTime;
};

#endif // LOGPROCESS_H
